// main.js
import { createApp } from 'vue'
import { createPinia } from 'pinia' // 引入 createPinia 来创建 Pinia 实例
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// ✅ 正确创建 Pinia 实例
const pinia = createPinia()
const app = createApp(App)

// 挂载插件和 Pinia
app.use(pinia) // ✅ 这里传入的是真正的 Pinia 实例
app.use(router)
app.use(ElementPlus)

// 注册所有 Element Plus 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.mount('#app')